// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SignTag.java

package com.vandagroup.security;

import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.util.ResponseUtils;

// Referenced classes of package com.vandagroup.security:
//            NetDsign

public class SignTag extends TagSupport
{

    private String value;

    public SignTag()
    {
        value = null;
    }

    public String getValue()
    {
        return value;
    }

    public void setValue(String value)
    {
        this.value = value;
    }

    public int doStartTag()
        throws JspException
    {
        HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
        String contexPath = request.getContextPath().equals("/") ? "" : request.getContextPath();
        String funcID = request.getParameter("_funcID");
        StringBuffer sb = new StringBuffer("<object classid=clsid:62B938C4-4190-4F37-8CF0-A92B0A91CC77 ");
        sb.append("codebase='" + contexPath + "/includes/security/NetSign.cab' data='data:application/x-oleobject;base64,xDi5YpBBN0+M8KkrCpHMdwADAACJEwAAPAcAAA=='");
        sb.append(" id='VNetSign' style='HEIGHT: 0px; WIDTH: 0px' VIEWASTEXT width='0' height='0'>");
        sb.append("<embed width='33' height='32' src='data:application/x-oleobject;base64,xDi5YpBBN0+M8KkrCpHMdwADAACJEwAAPAcAAA=='>");
        sb.append("</embed> ");
        sb.append("</object>\n");
        sb.append("<script language=javascript >var _dn='" + request.getSession().getAttribute("DN") + "'</script>\n");
        try
        {
            HashMap hm = NetDsign.getConfigInfo(funcID);
            if(hm == null)
                sb.append("<script language=javascript >var _signText=''</script>\n");
            else
                sb.append("<script language=javascript >var _signText='" + hmToStr(hm) + "'</script>\n");
        }
        catch(Exception e)
        {
            sb.append("<script language=javascript >var _signText='';</script>\n");
        }
        sb.append("<script language=javascript src='" + contexPath + "/includes/security/sign.js'></script>\n");
        sb.append("<INPUT TYPE='submit' value='" + value + "' name='_btnSubmit' class=btn onClick='return _sendHiddenArea()'>");
        sb.append("<INPUT TYPE='hidden'   name='signature' value='   '>");
        ResponseUtils.write(pageContext, sb.toString());
        return 1;
    }

    public int doEndTag()
        throws JspException
    {
        return 6;
    }

    public static String hmToStr(HashMap hm)
    {
        String str = "";
        Set keySet = hm.keySet();
        Iterator keyIterator = keySet.iterator();
        String key = null;
        while(keyIterator.hasNext()) 
        {
            key = (String)keyIterator.next();
            str = str + key + ":" + hm.get(key);
            if(keyIterator.hasNext())
                str = str + ";";
        }
        return str;
    }
}
